home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_08 / phillip2 / ed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-14  |  20.2 KB  |  770 lines

  1.  
  2.        /**********************************************
  3.        *
  4.        *   file d:\cips\ed.c
  5.        *
  6.        *   Functions: This file contains
  7.        *      erosion
  8.        *      dilation
  9.        *      mask_erosion
  10.        *      mask_dilation
  11.        *      interior_outline
  12.        *      exterior_outline
  13.        *      copy_3_x_3
  14.        *      opening
  15.        *      closing
  16.        *      get_shape_options
  17.        *
  18.        *   Purpose:
  19.        *      These functions perform the erosion,
  20.        *      dilation, outlining, opening and
  21.        *      closing operations.
  22.        *
  23.        *   External Calls:
  24.        *      wtiff.c - round_off_image_size
  25.        *                create_file_if_needed
  26.        *                write_array_into_tiff_image
  27.        *      tiff.c - read_tiff_header
  28.        *      rtiff.c - read_tiff_image
  29.        *      numcvrt.c - get_integer
  30.        *
  31.        *   Modifications:
  32.        *      14 March 1993 - created
  33.        *
  34.        ************************************************/
  35.  
  36. #include "cips.h"
  37.  
  38.  
  39.  
  40. short edmask1[3][3] = {{0, 1, 0},
  41.                        {0, 1, 0},
  42.                        {0, 1, 0}};
  43.  
  44. short edmask2[3][3] = {{0, 0, 0},
  45.                        {1, 1, 1},
  46.                        {0, 0, 0}};
  47.  
  48. short edmask3[3][3] = {{0, 1, 0},
  49.                        {1, 1, 1},
  50.                        {0, 1, 0}};
  51.  
  52. short edmask4[3][3] = {{1, 1, 1},
  53.                        {1, 1, 1},
  54.                        {1, 1, 1}};
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.      /*******************************************
  62.      *
  63.      *   mask_dilation(...
  64.      *
  65.      *   This function performs the dilation
  66.      *   operation using the erosion-dilation
  67.      *   3x3 masks given above.  It works on
  68.      *   0-value images.
  69.      *
  70.      *******************************************/
  71.  
  72. mask_dilation(in_name, out_name, the_image, out_image,
  73.               il, ie, ll, le, value, mask_type)
  74.    char   in_name[], out_name[];
  75.    int    il, ie, ll, le;
  76.    short  the_image[ROWS][COLS],
  77.           out_image[ROWS][COLS],
  78.           mask_type, value;
  79. {
  80.    int    a, b, count, i, j, k;
  81.    short  mask[3][3], max;
  82.  
  83.       /**************************************
  84.       *
  85.       *   Copy the 3x3 erosion-dilation mask
  86.       *   specified by the mask_type.
  87.       *
  88.       ***************************************/
  89.  
  90.    switch(mask_type){
  91.       case 1:
  92.          copy_3_x_3(mask, edmask1);
  93.          break;
  94.       case 2:
  95.          copy_3_x_3(mask, edmask2);
  96.          break;
  97.       case 3:
  98.          copy_3_x_3(mask, edmask3);
  99.          break;
  100.       case 4:
  101.          copy_3_x_3(mask, edmask4);
  102.          break;
  103.       default:
  104.          printf("\nInvalid mask type, using mask 4");
  105.          copy_3_x_3(mask, edmask4);
  106.          break;
  107.    }
  108.  
  109.    create_file_if_needed(in_name, out_name, out_image);
  110.  
  111.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  112.  
  113.       /***************************
  114.       *
  115.       *   Loop over image array
  116.       *
  117.       ****************************/
  118.  
  119.    printf("\n");
  120.  
  121.    for(i=1; i<ROWS-1; i++){
  122.       if( (i%10) == 0) printf("%3d", i);
  123.       for(j=1; j<COLS-1; j++){
  124.          max = 0;
  125.          for(a=-1; a<=1; a++){
  126.              for(b=-1; b<=1; b++){
  127.                 if(mask[a+1][b+1] == 1){
  128.                    if(the_image[i+a][j+b] > max)
  129.                       max = the_image[i+a][j+b];
  130.                 }  /* ends if mask == 1 */
  131.              }  /*  ends loop over b */
  132.          }  /* ends loop over a */
  133.          out_image[i][j] = max;
  134.       }  /* ends loop over j */
  135.    }  /* ends loop over i */
  136.  
  137.    fix_edges(out_image, 3);
  138.  
  139.    write_array_into_tiff_image(out_name, out_image,
  140.                                il, ie, ll, le);
  141.  
  142. }  /* ends mask_dilation */
  143.  
  144.  
  145.  
  146.  
  147.  
  148.      /*******************************************
  149.      *
  150.      *   mask_erosion(...
  151.      *
  152.      *   This function performs the erosion
  153.      *   operation using the erosion-dilation
  154.      *   3x3 masks given above.  It works on
  155.      *   0-value images.
  156.      *
  157.      *******************************************/
  158.  
  159. mask_erosion(in_name, out_name, the_image, out_image,
  160.              il, ie, ll, le, value, mask_type)
  161.    char   in_name[], out_name[];
  162.    int    il, ie, ll, le;
  163.    short  the_image[ROWS][COLS],
  164.           out_image[ROWS][COLS],
  165.           mask_type, value;
  166. {
  167.    int    a, b, count, i, j, k;
  168.    short  mask[3][3], min;
  169.  
  170.       /**************************************
  171.       *
  172.       *   Copy the 3x3 erosion-dilation mask
  173.       *   specified by the mask_type.
  174.       *
  175.       ***************************************/
  176.  
  177.    switch(mask_type){
  178.       case 1:
  179.          copy_3_x_3(mask, edmask1);
  180.          break;
  181.       case 2:
  182.          copy_3_x_3(mask, edmask2);
  183.          break;
  184.       case 3:
  185.          copy_3_x_3(mask, edmask3);
  186.          break;
  187.       case 4:
  188.          copy_3_x_3(mask, edmask4);
  189.          break;
  190.       default:
  191.          printf("\nInvalid mask type, using mask 4");
  192.          copy_3_x_3(mask, edmask4);
  193.          break;
  194.    }
  195.  
  196.    create_file_if_needed(in_name, out_name, out_image);
  197.  
  198.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  199.  
  200.       /***************************
  201.       *
  202.       *   Loop over image array
  203.       *
  204.       ****************************/
  205.  
  206.    printf("\n");
  207.  
  208.    for(i=1; i<ROWS-1; i++){
  209.       if( (i%10) == 0) printf("%3d", i);
  210.       for(j=1; j<COLS-1; j++){
  211.          min = value;
  212.          for(a=-1; a<=1; a++){
  213.              for(b=-1; b<=1; b++){
  214.                 if(mask[a+1][b+1] == 1){
  215.                    if(the_image[i+a][j+b] < min)
  216.                       min = the_image[i+a][j+b];
  217.                 }  /* ends if mask == 1 */
  218.              }  /*  ends loop over b */
  219.          }  /* ends loop over a */
  220.          out_image[i][j] = min;
  221.       }  /* ends loop over j */
  222.    }  /* ends loop over i */
  223.  
  224.    fix_edges(out_image, 3);
  225.  
  226.    write_array_into_tiff_image(out_name, out_image,
  227.                                il, ie, ll, le);
  228.  
  229. }  /* ends mask_erosion */
  230.  
  231.  
  232.  
  233.  
  234.  
  235.      /*******************************************
  236.      *
  237.      *   erosion(...
  238.      *
  239.      *   This function performs the erosion
  240.      *   operation.  If a value pixel has more
  241.      *   than the threshold number of 0
  242.      *   neighbors, you erode it by setting it
  243.      *   to 0.
  244.      *
  245.      *******************************************/
  246.  
  247. erosion(in_name, out_name, the_image, out_image,
  248.         il, ie, ll, le, value, threshold)
  249.    char   in_name[], out_name[];
  250.    int    il, ie, ll, le;
  251.    short  the_image[ROWS][COLS],
  252.           out_image[ROWS][COLS],
  253.           threshold, value;
  254. {
  255.    int    a, b, count, i, j, k;
  256.  
  257.    create_file_if_needed(in_name, out_name, out_image);
  258.  
  259.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  260.  
  261.       /***************************
  262.       *
  263.       *   Loop over image array
  264.       *
  265.       ****************************/
  266.  
  267.    for(i=0; i<ROWS; i++)
  268.       for(j=0; j<COLS; j++)
  269.          out_image[i][j] = the_image[i][j];
  270.  
  271.    printf("\n");
  272.  
  273.    for(i=1; i<ROWS-1; i++){
  274.       if( (i%10) == 0) printf("%3d", i);
  275.       for(j=1; j<COLS-1; j++){
  276.          if(the_image[i][j] == value){
  277.             count = 0;
  278.             for(a=-1; a<=1; a++){
  279.                 for(b=-1; b<=1; b++){
  280.                       if(the_image[i+a][j+b] == 0)
  281.                          count++;
  282.                 }  /*  ends loop over b */
  283.             }  /* ends loop over a */
  284.             if(count > threshold) out_image[i][j] = 0;
  285.          }  /* ends if the_image == value */
  286.       }  /* ends loop over j */
  287.    }  /* ends loop over i */
  288.  
  289.    fix_edges(out_image, 3);
  290.  
  291.    write_array_into_tiff_image(out_name, out_image,
  292.                                il, ie, ll, le);
  293.  
  294. }  /* ends erosion */
  295.  
  296.  
  297.  
  298.  
  299.  
  300.      /*******************************************
  301.      *
  302.      *   dilation(...
  303.      *
  304.      *   This function performs the dilation
  305.      *   operation.  If a 0 pixel has more than
  306.      *   threshold number of value neighbors,
  307.      *   you dilate it by setting it to value.
  308.      *
  309.      *******************************************/
  310.  
  311. dilation(in_name, out_name, the_image, out_image,
  312.          il, ie, ll, le, value, threshold)
  313.    char   in_name[], out_name[];
  314.    int    il, ie, ll, le;
  315.    short  the_image[ROWS][COLS],
  316.           out_image[ROWS][COLS],
  317.           threshold, value;
  318. {
  319.    int    a, b, count, i, j, k;
  320.  
  321.    create_file_if_needed(in_name, out_name, out_image);
  322.  
  323.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  324.  
  325.       /***************************
  326.       *
  327.       *   Loop over image array
  328.       *
  329.       ****************************/
  330.  
  331.    printf("\n");
  332.  
  333.    for(i=1; i<ROWS-1; i++){
  334.       if( (i%10) == 0) printf("%3d", i);
  335.       for(j=1; j<COLS-1; j++){
  336.          out_image[i][j] = the_image[i][j];
  337.          if(the_image[i][j] == 0){
  338.             count = 0;
  339.             for(a=-1; a<=1; a++){
  340.                 for(b=-1; b<=1; b++){
  341.                    if(a!=0  &&  b!=0){
  342.                       if(the_image[i+a][j+b] == value)
  343.                          count++;
  344.                    }  /* ends avoid the center pixel */
  345.                 }  /*  ends loop over b */
  346.             }  /* ends loop over a */
  347.             if(count > threshold)
  348.                out_image[i][j] = value;
  349.          }  /* ends if the_image == 0 */
  350.       }  /* ends loop over j */
  351.    }  /* ends loop over i */
  352.  
  353.    fix_edges(out_image, 3);
  354.  
  355.    write_array_into_tiff_image(out_name, out_image,
  356.                                il, ie, ll, le);
  357.  
  358. }  /* ends dilation */
  359.  
  360.  
  361.  
  362.  
  363.  
  364.      /*******************************************
  365.      *
  366.      *   interior_outline(...
  367.      *
  368.      *   This function produces the outline of
  369.      *   any "holes" inside an object.  The
  370.      *   method is:
  371.      *      output = erosion of input
  372.      *      final output = input - output
  373.      *
  374.      *******************************************/
  375.  
  376. interior_outline(in_name, out_name, the_image,
  377.                  out_image, il, ie, ll, le, value,
  378.                  mask_type)
  379.    char   in_name[], out_name[];
  380.    int    il, ie, ll, le;
  381.    short  the_image[ROWS][COLS],
  382.           out_image[ROWS][COLS],
  383.           mask_type, value;
  384. {
  385.    int    a, b, count, i, j, k;
  386.    short  mask[3][3], max;
  387.  
  388.       /**************************************
  389.       *
  390.       *   Copy the 3x3 erosion-dilation mask
  391.       *   specified by the mask_type.
  392.       *
  393.       ***************************************/
  394.  
  395.    switch(mask_type){
  396.       case 1:
  397.          copy_3_x_3(mask, edmask1);
  398.          break;
  399.       case 2:
  400.          copy_3_x_3(mask, edmask2);
  401.          break;
  402.       case 3:
  403.          copy_3_x_3(mask, edmask3);
  404.          break;
  405.       case 4:
  406.          copy_3_x_3(mask, edmask4);
  407.          break;
  408.       default:
  409.          printf("\nInvalid mask type, using mask 4");
  410.          copy_3_x_3(mask, edmask4);
  411.          break;
  412.    }
  413.  
  414.    create_file_if_needed(in_name, out_name, out_image);
  415.  
  416.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  417.  
  418.    mask_erosion(in_name, out_name, the_image,
  419.                 out_image, il, ie, ll, le,
  420.                 value, mask_type);
  421.  
  422.    for(i=0; i<ROWS; i++)
  423.       for(j=0; j<COLS; j++)
  424.          the_image[i][j] =
  425.             the_image[i][j] - out_image[i][j];
  426.  
  427.    write_array_into_tiff_image(out_name, the_image,
  428.                                il, ie, ll, le);
  429.  
  430. }  /* ends interior_outline */
  431.  
  432.  
  433.  
  434.  
  435.  
  436.      /*******************************************
  437.      *
  438.      *   exterior_outline(...
  439.      *
  440.      *   This function produces the outline of
  441.      *   exterior of an object.  The
  442.      *   method is:
  443.      *      output = dilation of input
  444.      *      final output = output - input
  445.      *
  446.      *******************************************/
  447.  
  448.  
  449. exterior_outline(in_name, out_name, the_image, out_image,
  450.           il, ie, ll, le, value, mask_type)
  451.    char   in_name[], out_name[];
  452.    int    il, ie, ll, le;
  453.    short  the_image[ROWS][COLS],
  454.           out_image[ROWS][COLS],
  455.           mask_type, value;
  456. {
  457.    int    a, b, count, i, j, k;
  458.    short  mask[3][3], max;
  459.  
  460.       /**************************************
  461.       *
  462.       *   Copy the 3x3 erosion-dilation mask
  463.       *   specified by the mask_type.
  464.       *
  465.       ***************************************/
  466.  
  467.    switch(mask_type){
  468.       case 1:
  469.          copy_3_x_3(mask, edmask1);
  470.          break;
  471.       case 2:
  472.          copy_3_x_3(mask, edmask2);
  473.          break;
  474.       case 3:
  475.          copy_3_x_3(mask, edmask3);
  476.          break;
  477.       case 4:
  478.          copy_3_x_3(mask, edmask4);
  479.          break;
  480.       default:
  481.          printf("\nInvalid mask type, using mask 4");
  482.          copy_3_x_3(mask, edmask4);
  483.          break;
  484.    }
  485.  
  486.    create_file_if_needed(in_name, out_name, out_image);
  487.  
  488.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  489.  
  490.    mask_dilation(in_name, out_name, the_image,
  491.                  out_image, il, ie, ll, le,
  492.                  value, mask_type);
  493.  
  494.    for(i=0; i<ROWS; i++)
  495.       for(j=0; j<COLS; j++)
  496.          the_image[i][j] =
  497.             out_image[i][j] - the_image[i][j];
  498.  
  499.    write_array_into_tiff_image(out_name, the_image,
  500.                                il, ie, ll, le);
  501.  
  502. }  /* ends exterior_outline */
  503.  
  504.  
  505.      /***********************************************
  506.      *
  507.      *   copy_3_x_3(a, b)
  508.      *
  509.      *   This function copies a 3x3 array of shorts
  510.      *   from one array to another.  It copies array
  511.      *   b into array a.
  512.      *
  513.      ***********************************************/
  514.  
  515. copy_3_x_3(a, b)
  516.    short a[3][3], b[3][3];
  517. {
  518.    int i, j;
  519.    for(i=0; i<3; i++)
  520.       for(j=0; j<3; j++)
  521.          a[i][j] = b[i][j];
  522. }  /* ends copy_3_x_3 */
  523.  
  524.  
  525.  
  526.  
  527.  
  528.      /*******************************************
  529.      *
  530.      *   opening(...
  531.      *
  532.      *   Opening is erosion followed by dilation.
  533.      *   This routine will use the mask erosion
  534.      *   and dilation.  You could use the other
  535.      *   types and you could mix the two types.
  536.      *
  537.      *   The number parameter specifies how
  538.      *   erosions to perform before doing one
  539.      *   dilation.
  540.      *
  541.      *******************************************/
  542.  
  543. opening(in_name, out_name, the_image, out_image,
  544.         il, ie, ll, le, value, mask_type, number)
  545.    char   in_name[], out_name[];
  546.    int    il, ie, ll, le, number;
  547.    short  the_image[ROWS][COLS],
  548.           out_image[ROWS][COLS],
  549.           mask_type, value;
  550. {
  551.    int    a, b, count, i, j, k;
  552.    short  mask[3][3], max;
  553.  
  554.       /**************************************
  555.       *
  556.       *   Copy the 3x3 erosion-dilation mask
  557.       *   specified by the mask_type.
  558.       *
  559.       ***************************************/
  560.  
  561.    switch(mask_type){
  562.       case 1:
  563.          copy_3_x_3(mask, edmask1);
  564.          break;
  565.       case 2:
  566.          copy_3_x_3(mask, edmask2);
  567.          break;
  568.       case 3:
  569.          copy_3_x_3(mask, edmask3);
  570.          break;
  571.       case 4:
  572.          copy_3_x_3(mask, edmask4);
  573.          break;
  574.       default:
  575.          printf("\nInvalid mask type, using mask 4");
  576.          copy_3_x_3(mask, edmask4);
  577.          break;
  578.    }
  579.  
  580.    create_file_if_needed(in_name, out_name, out_image);
  581.  
  582.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  583.  
  584.    mask_erosion(in_name, out_name, the_image,
  585.                 out_image, il, ie, ll, le,
  586.                 value, mask_type);
  587.  
  588.    if(number > 1){
  589.       count = 1;
  590.       while(count < number){
  591.          count++;
  592.          mask_erosion(out_name, out_name, the_image,
  593.                        out_image, il, ie, ll, le,
  594.                        value, mask_type);
  595.       }  /* ends while */
  596.    }  /* ends if number > 1 */
  597.  
  598.    mask_dilation(out_name, out_name, the_image,
  599.                  out_image, il, ie, ll, le,
  600.                  value, mask_type);
  601.  
  602.    write_array_into_tiff_image(out_name, out_image,
  603.                                il, ie, ll, le);
  604.  
  605. }  /* ends opening */
  606.  
  607.  
  608.  
  609.  
  610.  
  611.      /*******************************************
  612.      *
  613.      *   closing(...
  614.      *
  615.      *   Closing is dilation followed by erosion.
  616.      *   This routine will use the mask erosion
  617.      *   and dilation.  You could use the other
  618.      *   types and you could mix the two types.
  619.      *
  620.      *   The number parameter specifies how
  621.      *   dilations to perform before doing one
  622.      *   erosion.
  623.      *
  624.      *******************************************/
  625.  
  626. closing(in_name, out_name, the_image, out_image,
  627.         il, ie, ll, le, value, mask_type, number)
  628.    char   in_name[], out_name[];
  629.    int    il, ie, ll, le, number;
  630.    short  the_image[ROWS][COLS],
  631.           out_image[ROWS][COLS],
  632.           mask_type, value;
  633. {
  634.    int    a, b, count, i, j, k;
  635.    short  mask[3][3], max;
  636.  
  637.       /**************************************
  638.       *
  639.       *   Copy the 3x3 erosion-dilation mask
  640.       *   specified by the mask_type.
  641.       *
  642.       ***************************************/
  643.  
  644.    switch(mask_type){
  645.       case 1:
  646.          copy_3_x_3(mask, edmask1);
  647.          break;
  648.       case 2:
  649.          copy_3_x_3(mask, edmask2);
  650.          break;
  651.       case 3:
  652.          copy_3_x_3(mask, edmask3);
  653.          break;
  654.       case 4:
  655.          copy_3_x_3(mask, edmask4);
  656.          break;
  657.       default:
  658.          printf("\nInvalid mask type, using mask 4");
  659.          copy_3_x_3(mask, edmask4);
  660.          break;
  661.    }
  662.  
  663.    create_file_if_needed(in_name, out_name, out_image);
  664.  
  665.    read_tiff_image(in_name, the_image, il, ie, ll, le);
  666.  
  667.    mask_dilation(in_name, out_name, the_image,
  668.                  out_image, il, ie, ll, le,
  669.                  value, mask_type);
  670.  
  671.    if(number > 1){
  672.       count = 1;
  673.       while(count < number){
  674.          count++;
  675.          mask_dilation(out_name, out_name, the_image,
  676.                         out_image, il, ie, ll, le,
  677.                         value, mask_type);
  678.       }  /* ends while */
  679.    }  /* ends if number > 1 */
  680.  
  681.    mask_erosion(out_name, out_name, the_image,
  682.                 out_image, il, ie, ll, le,
  683.                 value, mask_type);
  684.  
  685.    write_array_into_tiff_image(out_name, out_image,
  686.                                il, ie, ll, le);
  687.  
  688. }  /* ends closing */
  689.  
  690.  
  691.  
  692.  
  693.  
  694.      /*******************************************
  695.      *
  696.      *   get_shape_options(...
  697.      *
  698.      *   This function interacts with the user
  699.      *   to obtain the parameters for calling
  700.      *   the shape routines.
  701.      *
  702.      *******************************************/
  703.  
  704. get_shape_options(type, value, threshold, number)
  705.    char   type[];
  706.    int    *number, *threshold;
  707.    short  *value;
  708. {
  709.    int not_finished = 1, response;
  710.  
  711.    while(not_finished){
  712.  
  713.    printf("\nThe shape options are:");
  714.    printf("\n\t1. Type is %s", type);
  715.    printf("\n\t    recall: EROsion DILation Mask-ERosion"
  716.           "\n\t            Mask_DIlation INTerior-outline"
  717.           "\n\t            EXTerior-outline THInning"
  718.           "\n\t            Dilate-Not-Join OPEning"
  719.           "\n\t            CLOsing SPecial-Opening"
  720.           "\n\t            SPecial-Closing"
  721.           "\n\t            Euclidean-Distance-Measure"
  722.           "\n\t            Medial-Axis-Transform");
  723.    printf("\n\t2. value is %d", *value);
  724.    printf("\n\t3. threshold or mask type is %d",
  725.            *threshold);
  726.    printf("\n\t4. number of iterations is %d", *number);
  727.    printf("\n\t   (used only in opening and closing)");
  728.    printf("\n\nEnter choice (0 = no change) _\b");
  729.  
  730.       get_integer(&response);
  731.  
  732.       if(response == 0){
  733.         not_finished = 0;
  734.       }
  735.  
  736.       if(response == 1){
  737.       printf("\nEnter type of operation");
  738.       printf("\n\t    recall: EROsion DILation Mask-ERosion"
  739.              "\n\t            Mask_DIlation INTerior-outline"
  740.              "\n\t            EXTerior-outline THInning"
  741.              "\n\t            Dilate-Not-Join OPEning"
  742.              "\n\t            CLOsing SPecial-Opening"
  743.              "\n\t            SPecial-Closing"
  744.              "\n\t            Euclidean-Distance-Measure"
  745.              "\n\t            Medial-Axis-Transform");
  746.       printf("\n\t:");
  747.       gets(type);
  748.       }
  749.  
  750.       if(response == 2){
  751.          printf("\nEnter value: ___\b\b\b");
  752.          get_integer(value);
  753.       }
  754.  
  755.       if(response == 3){
  756.          printf("\nEnter threshold or mask type: ___");
  757.          printf("\b\b\b");
  758.          get_integer(threshold);
  759.       }
  760.  
  761.       if(response == 4){
  762.          printf("\nEnter number of iterations: ___");
  763.          printf("\b\b\b");
  764.          get_integer(number);
  765.       }
  766.  
  767.    }  /* ends while not_finished */
  768.  
  769. }  /* ends get_shape_options */
  770.